
/**
 * Holds information from both Reservations and Flight Reservations
 * 
 *
 */
public class FlightReservation {
	
	private Double totalPrice;
	
	private Customer customer;
	private Employee bookingAgent;
	
	private long reservationID;
	
	private boolean idSet = false;
	
	public FlightReservation(Customer customer, Employee bookingAgent, Double totalPrice) {
		
		this.customer = customer;
		this.bookingAgent = bookingAgent;
		this.totalPrice = totalPrice;
	}

	/**
	 * @param totalPrice the totalPrice to set
	 */
	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}

	/**
	 * @return the totalPrice
	 */
	public Double getTotalPrice() {
		return totalPrice;
	}

	/**
	 * @param customer the customer to set
	 */
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	/**
	 * @return the customer
	 */
	public Customer getCustomer() {
		return customer;
	}

	/**
	 * @param bookingAgent the bookingAgent to set
	 */
	public void setBookingAgent(Employee bookingAgent) {
		this.bookingAgent = bookingAgent;
	}

	/**
	 * @return the bookingAgent
	 */
	public Employee getBookingAgent() {
		return bookingAgent;
	}

	/**
	 * @param reservationID the reservationID to set
	 */
	public void setReservationID(long reservationID) {
		this.reservationID = reservationID;
		idSet = true;
	}

	/**
	 * @return the reservationID
	 */
	public long getReservationID() {
		return reservationID;
	}
	
	public boolean isIdSet() {
		
		return idSet;
	}
	
	@Override
	public boolean equals(Object fr) {
		if (fr instanceof FlightReservation) {
			FlightReservation frOther = (FlightReservation) fr;
			return ((frOther.getCustomer().getCustomerID() == customer.getCustomerID()) &&
					(frOther.getBookingAgent().getEmployeeID() == bookingAgent.getEmployeeID()) &&
					(frOther.getTotalPrice().equals(totalPrice)));
		}
		return false;
	}

    @Override
    public int hashCode() {
        return (int)(customer.getCustomerID() ^ bookingAgent.getEmployeeID() ^ totalPrice.hashCode());
    }

}

